package com.samoiloff.framework.model {
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import com.samoiloff.framework.BaseComponent;

	import flash.display.MovieClip;

	/**
	 * @author Samoiloff
	 */
	public class BaseModel extends EventDispatcher {
		
		protected var _component	: BaseComponent;		
		protected var _mainMc		: MovieClip;
		
		private var _ready:Boolean;
		
		public function BaseModel(component:BaseComponent) {
			_component = component;
		}

		protected function setMainMc(mainMc:MovieClip):void {
			_mainMc = mainMc;
		}
		
		protected function complete():void {
			_ready = true;
			dispatchEvent(new Event(Event.COMPLETE));
		}
		
		public function get ready(): Boolean {
			return _ready;
		}
		public function destroy():void {
			_component = null;
			_mainMc = null;
		}
		
		public function get mainMc(): MovieClip {
			return _mainMc;
		}
	}
}
